package cn.wolfcode.p2p.mgrsite.mgrsite;

import cn.wolfcode.p2p.base.service.ILofinInfoService;
import cn.wolfcode.p2p.bussness.service.ISystemAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/*
    监听器
 */
@Component
public class InitAdminListener implements ApplicationListener<ContextRefreshedEvent> {

    @Autowired
    private ILofinInfoService lofinInfoService;
    @Autowired
    private ISystemAccountService systemAccountService;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        //所有bean都已经加载完毕之后操作
        lofinInfoService.initAdmin();
        //初始化系统账户
        systemAccountService.initAccount();
    }
}
